var order_info = new Vue({
    el: "#cart",
    data: {
        nickname: handleLocalStorage("get", "nickname"),
        orderInfo: [],
    },
    mounted: function () {
        this.getOrder();
    },
    methods: {
        getOrder() {
            var id = getQueryVariable("id");
            if (this.nickname == '') {
                alert("当前未登录！");
                window.location.href = "/user/login-register.html";
            } else {
                $.ajax({
                    url: "/user/orderInfo/"+id,
                    type: "GET",
                    headers: {
                        "Authorization": "Bearer " + handleLocalStorage("get", "token")
                    },
                    dataType: "json",
                    data: {},
                    success: function (response) {
                        if (response.code == 200) {
                            order_info.orderInfo = response.data;
                        } else {
                            alert(response.message);
                        }
                    },
                    error: function (error) {
                        alert("服务器错误");
                    }
                });
            }
        }
    }
});
